/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { Contest } from '../models/Contest';
import type { ContestProblem } from '../models/ContestProblem';
import type { ContestSubmitDTO } from '../models/ContestSubmitDTO';
import type { ContestSubmission } from '../models/ContestSubmission';
import type { ContestAnnouncement } from '../models/ContestAnnouncement';
import type { ContestRanking } from '../models/ContestRanking';
import type { BaseResponse_boolean_ } from '../models/BaseResponse_boolean_';
import type { BaseResponse_Contest_ } from '../models/BaseResponse_Contest_';
import type { BaseResponse_Page_Contest_ } from '../models/BaseResponse_Page_Contest_';
import type { BaseResponse_List_ContestProblem_ } from '../models/BaseResponse_List_ContestProblem_';
import type { BaseResponse_ContestSubmission_ } from '../models/BaseResponse_ContestSubmission_';
import type { BaseResponse_IPage_ContestSubmission_ } from '../models/BaseResponse_IPage_ContestSubmission_';
import type { BaseResponse_List_ContestAnnouncement_ } from '../models/BaseResponse_List_ContestAnnouncement_';
import type { BaseResponse_ContestAnnouncement_ } from '../models/BaseResponse_ContestAnnouncement_';
import type { BaseResponse_List_ContestRanking_ } from '../models/BaseResponse_List_ContestRanking_';
import type { BaseResponse_Map_string_object_ } from '../models/BaseResponse_Map_string_object_';
import type { BaseResponse_Void_ } from '../models/BaseResponse_Void_';

import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';

export class ContestControllerService {
  /**
   * 获取比赛列表
   * @param page 页码
   * @param size 每页大小
   * @param status 比赛状态
   * @returns BaseResponse_Page_Contest_ OK
   * @throws ApiError
   */
  public static getContestListUsingGet(
    page?: number,
    size?: number,
    status?: number,
  ): CancelablePromise<BaseResponse_Page_Contest_> {
    return __request(OpenAPI, {
      method: 'GET',
      url: '/api/contests',
      query: {
        'page': page,
        'size': size,
        'status': status,
      },
    });
  }

  /**
   * 创建比赛
   * @param contest 比赛信息
   * @returns BaseResponse_boolean_ OK
   * @throws ApiError
   */
  public static createContestUsingPost(
    contest: Contest,
  ): CancelablePromise<BaseResponse_boolean_> {
    return __request(OpenAPI, {
      method: 'POST',
      url: '/api/contests',
      body: contest,
    });
  }

  /**
   * 获取比赛详情
   * @param contestId 比赛ID
   * @returns BaseResponse_Contest_ OK
   * @throws ApiError
   */
  public static getContestDetailUsingGet(
    contestId: number,
  ): CancelablePromise<BaseResponse_Contest_> {
    return __request(OpenAPI, {
      method: 'GET',
      url: `/api/contests/${contestId}`,
    });
  }

  /**
   * 编辑比赛
   * @param contestId 比赛ID
   * @param contest 比赛信息
   * @returns BaseResponse_boolean_ OK
   * @throws ApiError
   */
  public static updateContestUsingPut(
    contestId: number,
    contest: Contest,
  ): CancelablePromise<BaseResponse_boolean_> {
    return __request(OpenAPI, {
      method: 'PUT',
      url: `/api/contests/${contestId}`,
      body: contest,
    });
  }

  /**
   * 删除比赛
   * @param contestId 比赛ID
   * @returns BaseResponse_boolean_ OK
   * @throws ApiError
   */
  public static deleteContestUsingDelete(
    contestId: number,
  ): CancelablePromise<BaseResponse_boolean_> {
    return __request(OpenAPI, {
      method: 'DELETE',
      url: `/api/contests/${contestId}`,
    });
  }

  /**
   * 获取比赛题目列表
   * @param contestId 比赛ID
   * @returns BaseResponse_List_ContestProblem_ OK
   * @throws ApiError
   */
  public static getContestProblemsUsingGet(
    contestId: number,
  ): CancelablePromise<BaseResponse_List_ContestProblem_> {
    return __request(OpenAPI, {
      method: 'GET',
      url: `/api/contests/${contestId}/problems`,
    });
  }

  /**
   * 添加题目到比赛
   * @param contestId 比赛ID
   * @param problem 题目信息
   * @returns BaseResponse_boolean_ OK
   * @throws ApiError
   */
  public static addProblemToContestUsingPost(
    contestId: number,
    problem: ContestProblem,
  ): CancelablePromise<BaseResponse_boolean_> {
    return __request(OpenAPI, {
      method: 'POST',
      url: `/api/contests/${contestId}/problems`,
      body: problem,
    });
  }

  /**
   * 从比赛中移除题目
   * @param contestId 比赛ID
   * @param problemId 题目ID
   * @returns BaseResponse_boolean_ OK
   * @throws ApiError
   */
  public static removeProblemFromContestUsingDelete(
    contestId: number,
    problemId: number,
  ): CancelablePromise<BaseResponse_boolean_> {
    return __request(OpenAPI, {
      method: 'DELETE',
      url: `/api/contests/${contestId}/problems/${problemId}`,
    });
  }

  /**
   * 注册比赛
   * @param contestId 比赛ID
   * @returns BaseResponse_boolean_ OK
   * @throws ApiError
   */
  public static registerContestUsingPost(
    contestId: number,
  ): CancelablePromise<BaseResponse_boolean_> {
    return __request(OpenAPI, {
      method: 'POST',
      url: `/api/contests/${contestId}/register`,
    });
  }

  /**
   * 获取比赛提交记录
   * @param contestId 比赛ID
   * @param page 页码
   * @param size 每页大小
   * @returns BaseResponse_IPage_ContestSubmission_ OK
   * @throws ApiError
   */
  public static getContestSubmissionsUsingGet(
    contestId: number,
    page?: number,
    size?: number,
  ): CancelablePromise<BaseResponse_IPage_ContestSubmission_> {
    return __request(OpenAPI, {
      method: 'GET',
      url: `/api/contests/${contestId}/submissions`,
      query: {
        'page': page,
        'size': size,
      },
    });
  }

  /**
   * 提交比赛题目
   * @param contestId 比赛ID
   * @param submitDTO 提交信息
   * @returns BaseResponse_ContestSubmission_ OK
   * @throws ApiError
   */
  public static submitContestProblemUsingPost(
    contestId: number,
    submitDTO: ContestSubmitDTO,
  ): CancelablePromise<BaseResponse_ContestSubmission_> {
    return __request(OpenAPI, {
      method: 'POST',
      url: `/api/contests/${contestId}/submissions`,
      body: submitDTO,
    });
  }

  /**
   * 获取提交详情
   * @param contestId 比赛ID
   * @param submissionId 提交ID
   * @returns any OK
   * @throws ApiError
   */
  public static getSubmissionDetailUsingGet(
    contestId: number,
    submissionId: number,
  ): CancelablePromise<any> {
    return __request(OpenAPI, {
      method: 'GET',
      url: `/api/contests/${contestId}/submissions/${submissionId}`,
    });
  }

  /**
   * 获取比赛公告列表
   * @param contestId 比赛ID
   * @returns BaseResponse_List_ContestAnnouncement_ OK
   * @throws ApiError
   */
  public static getContestAnnouncementsUsingGet(
    contestId: number,
  ): CancelablePromise<BaseResponse_List_ContestAnnouncement_> {
    return __request(OpenAPI, {
      method: 'GET',
      url: `/api/contests/${contestId}/announcements`,
    });
  }

  /**
   * 添加比赛公告
   * @param contestId 比赛ID
   * @param announcement 公告信息
   * @returns BaseResponse_boolean_ OK
   * @throws ApiError
   */
  public static addContestAnnouncementUsingPost(
    contestId: number,
    announcement: ContestAnnouncement,
  ): CancelablePromise<BaseResponse_boolean_> {
    return __request(OpenAPI, {
      method: 'POST',
      url: `/api/contests/${contestId}/announcements`,
      body: announcement,
    });
  }

  /**
   * 获取比赛公告详情
   * @param contestId 比赛ID
   * @param announcementId 公告ID
   * @returns BaseResponse_ContestAnnouncement_ OK
   * @throws ApiError
   */
  public static getContestAnnouncementDetailUsingGet(
    contestId: number,
    announcementId: number,
  ): CancelablePromise<BaseResponse_ContestAnnouncement_> {
    return __request(OpenAPI, {
      method: 'GET',
      url: `/api/contests/${contestId}/announcements/${announcementId}`,
    });
  }

  /**
   * 更新比赛公告
   * @param contestId 比赛ID
   * @param announcementId 公告ID
   * @param announcement 公告信息
   * @returns BaseResponse_boolean_ OK
   * @throws ApiError
   */
  public static updateContestAnnouncementUsingPut(
    contestId: number,
    announcementId: number,
    announcement: ContestAnnouncement,
  ): CancelablePromise<BaseResponse_boolean_> {
    return __request(OpenAPI, {
      method: 'PUT',
      url: `/api/contests/${contestId}/announcements/${announcementId}`,
      body: announcement,
    });
  }

  /**
   * 删除比赛公告
   * @param contestId 比赛ID
   * @param announcementId 公告ID
   * @returns BaseResponse_boolean_ OK
   * @throws ApiError
   */
  public static deleteContestAnnouncementUsingDelete(
    contestId: number,
    announcementId: number,
  ): CancelablePromise<BaseResponse_boolean_> {
    return __request(OpenAPI, {
      method: 'DELETE',
      url: `/api/contests/${contestId}/announcements/${announcementId}`,
    });
  }

  /**
   * 获取比赛排名
   * @param contestId 比赛ID
   * @param page 页码
   * @param size 每页大小
   * @returns BaseResponse_List_ContestRanking_ OK
   * @throws ApiError
   */
  public static getContestRankingUsingGet(
    contestId: number,
    page?: number,
    size?: number,
  ): CancelablePromise<BaseResponse_List_ContestRanking_> {
    return __request(OpenAPI, {
      method: 'GET',
      url: `/api/contests/${contestId}/ranking`,
      query: {
        'page': page,
        'size': size,
      },
    });
  }

  /**
   * 获取我的排名
   * @param contestId 比赛ID
   * @param userId 用户ID
   * @returns BaseResponse_Map_string_object_ OK
   * @throws ApiError
   */
  public static getMyRankingUsingGet(
    contestId: number,
    userId: number,
  ): CancelablePromise<BaseResponse_Map_string_object_> {
    return __request(OpenAPI, {
      method: 'GET',
      url: `/api/contests/${contestId}/ranking/my`,
      query: {
        'userId': userId,
      },
    });
  }

  /**
   * 刷新排名
   * @param contestId 比赛ID
   * @returns BaseResponse_Void_ OK
   * @throws ApiError
   */
  public static refreshRankingUsingPost(
    contestId: number,
  ): CancelablePromise<BaseResponse_Void_> {
    return __request(OpenAPI, {
      method: 'POST',
      url: `/api/contests/${contestId}/ranking/refresh`,
    });
  }
} 